package com.burstly.lib.component.networkcomponent.burstly;

import com.burstly.lib.util.CacheUtils;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.Utils;
import java.util.concurrent.atomic.AtomicLong;

public final class DayBasedCacheTimer extends AtomicLong
{
  private static final LoggerExt LOG = LoggerExt.getInstance();
  private static final String TAG = "DayBasedCacheTimer";
  private static final long serialVersionUID = 6806126616036020970L;
  private final Long mDefaultValue;

  public DayBasedCacheTimer(Long paramLong)
  {
    set(paramLong.longValue());
    this.mDefaultValue = paramLong;
  }

  public void setNewTTLValue(Long paramLong)
  {
    if (paramLong != null)
      set(paramLong.longValue());
  }

  public void setNewTTLValue(String paramString)
  {
    if (paramString != null)
    {
      Integer localInteger = Utils.getIntValue(paramString, Integer.valueOf(CacheUtils.getDaysFromMillis(get())));
      set(CacheUtils.getMillisFromDays(localInteger.intValue()));
      LOG.logInfo("DayBasedCacheTimer", "Time based cache ttl set to {0} days", new Object[] { localInteger });
      return;
    }
    LoggerExt localLoggerExt = LOG;
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = this.mDefaultValue;
    localLoggerExt.logInfo("DayBasedCacheTimer", "No time based ttl in config from server, setting default value {0}ms", arrayOfObject);
    set(this.mDefaultValue.longValue());
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.component.networkcomponent.burstly.DayBasedCacheTimer
 * JD-Core Version:    0.6.2
 */